extern crate net_brd;

// use net_brd::BrdTask;
use net_brd::excutive::CmdRun;
use net_brd::ChainData;
use net_brd::Color;

fn main() {
    let mut task = "cmd://curl@".push_args(&vec!["http://www.baidu.com"]);
    task.push_str("->2");
    if let Some(t) = task.to_task(){
        let f = t.new_chain();
        log::info!("{}", f);
    }

    let mut task = "curl".with_cmd().output(net_brd::OUTPUT_TO_BRD).to_owned();
    task.set_args(&vec!["http://www.baidu.com"]);
    log ::info!("test : {}",task);
    let mut brd_c = task.new_chain();
    log::info!("test ready {}",brd_c);
    brd_c.run();
    log::info!("test running {}",brd_c);
    for uid in net_brd::data::ls_brd(){
        log::info!("old exists : {}", uid.yellow());
        uid.chain_remove();
    }


    let mut brd_task = "curl".with_cmd()
        .args(&vec!["-sS","https://www.douban.com"])
        .output(net_brd::OUTPUT_TO_MANY_BRD | net_brd::OUTPUT_TO_LOG)
        .new_chain();
    log::info!("{}", brd_task);
    brd_task.run();
    log::info!("runnig : {}", brd_task);

    std::thread::sleep(std::time::Duration::from_secs(1));
    log::info!("runnig : {}", brd_task);
    // brd_task.loc.uid.brd_remove();
}
